﻿using HardcoreGame.Common.Players;
using HardcoreGame.Content.Buffs;
using Terraria;
using Terraria.ModLoader;

namespace HardcoreGame.Common.GlobalItems
{
    public class StaminaItem : GlobalItem
    {
        public override bool WingUpdate(int wings, Player player, bool inUse)
        {
            StaminaPlayer modPlayer = player.GetModPlayer<StaminaPlayer>();
            modPlayer.IsFlying = inUse;
            modPlayer.HasCheckedFlying = true;
            return false;
        }
        public override bool CanUseItem(Item item, Player player)
        {
            return player.FindBuffIndex(ModContent.BuffType<ExhaustionBuff>()) == -1 && base.CanUseItem(item, player);
        }
    }
}
